.class Lcom/esfile/screen/recorder/player/exo/c;
.super Ljava/lang/Object;
.source "GLVideoRender.java"

# interfaces
.implements Landroid/opengl/GLSurfaceView$Renderer;
.implements Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/esfile/screen/recorder/player/exo/c$a;
    }
.end annotation


# instance fields
.field private a:Lcom/esfile/screen/recorder/media/glutils/e;

.field private b:Lcom/esfile/screen/recorder/player/exo/c$a;

.field private c:I

.field private d:I

.field private e:Landroid/graphics/SurfaceTexture;

.field private f:I

.field private g:I

.field private h:Landroid/graphics/Rect;

.field private i:Landroid/graphics/Rect;

.field private j:I

.field private k:Landroid/graphics/RectF;

.field private l:Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;


# direct methods
.method constructor <init>(Lcom/esfile/screen/recorder/player/exo/c$a;)V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, -0x1

    .line 2
    iput v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->c:I

    .line 3
    iput v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->d:I

    .line 4
    iput v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->f:I

    .line 5
    iput v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->g:I

    .line 6
    new-instance v0, Landroid/graphics/Rect;

    invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V

    iput-object v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->h:Landroid/graphics/Rect;

    const/4 v0, 0x0

    .line 7
    iput v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->j:I

    .line 8
    sget-object v0, Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;->FIT_XY:Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;

    iput-object v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->l:Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;

    .line 9
    iput-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->b:Lcom/esfile/screen/recorder/player/exo/c$a;

    return-void
.end method

.method private b()V
    .locals 9

    .line 1
    iget v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->f:I

    if-lez v0, :cond_6

    iget v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->g:I

    if-gtz v0, :cond_0

    goto/16 :goto_3

    .line 2
    :cond_0
    iget v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->c:I

    if-lez v0, :cond_6

    iget v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->d:I

    if-gtz v0, :cond_1

    goto/16 :goto_3

    .line 3
    :cond_1
    iget v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->j:I

    div-int/lit8 v0, v0, 0x5a

    rem-int/lit8 v0, v0, 0x2

    if-eqz v0, :cond_2

    const/4 v0, 0x1

    goto :goto_0

    :cond_2
    const/4 v0, 0x0

    :goto_0
    if-eqz v0, :cond_3

    .line 4
    iget v1, p0, Lcom/esfile/screen/recorder/player/exo/c;->g:I

    goto :goto_1

    :cond_3
    iget v1, p0, Lcom/esfile/screen/recorder/player/exo/c;->f:I

    :goto_1
    if-eqz v0, :cond_4

    .line 5
    iget v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->f:I

    goto :goto_2

    :cond_4
    iget v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->g:I

    .line 6
    :goto_2
    iget-object v2, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    if-eqz v2, :cond_5

    invoke-virtual {v2}, Landroid/graphics/RectF;->width()F

    move-result v2

    const/4 v3, 0x0

    cmpl-float v2, v2, v3

    if-lez v2, :cond_5

    iget-object v2, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    invoke-virtual {v2}, Landroid/graphics/RectF;->height()F

    move-result v2

    cmpl-float v2, v2, v3

    if-lez v2, :cond_5

    .line 7
    iget v2, p0, Lcom/esfile/screen/recorder/player/exo/c;->c:I

    iget v3, p0, Lcom/esfile/screen/recorder/player/exo/c;->d:I

    iget-object v4, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    .line 8
    invoke-virtual {v4}, Landroid/graphics/RectF;->width()F

    move-result v4

    float-to-int v4, v4

    iget-object v5, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    invoke-virtual {v5}, Landroid/graphics/RectF;->height()F

    move-result v5

    float-to-int v5, v5

    iget-object v6, p0, Lcom/esfile/screen/recorder/player/exo/c;->l:Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;

    .line 9
    invoke-static {v2, v3, v4, v5, v6}, Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil;->a(IIIILcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;)Landroid/graphics/Rect;

    move-result-object v2

    .line 10
    iput-object v2, p0, Lcom/esfile/screen/recorder/player/exo/c;->i:Landroid/graphics/Rect;

    .line 11
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "video crop rect:"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v4, p0, Lcom/esfile/screen/recorder/player/exo/c;->i:Landroid/graphics/Rect;

    invoke-virtual {v4}, Landroid/graphics/Rect;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    const-string v4, "GLVideoRender"

    invoke-static {v4, v3}, Lcom/esfile/screen/recorder/media/util/k;->c(Ljava/lang/String;Ljava/lang/String;)V

    .line 12
    invoke-virtual {v2}, Landroid/graphics/Rect;->width()I

    move-result v3

    int-to-float v3, v3

    const/high16 v4, 0x3f800000    # 1.0f

    mul-float v3, v3, v4

    iget-object v5, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    invoke-virtual {v5}, Landroid/graphics/RectF;->width()F

    move-result v5

    div-float/2addr v3, v5

    .line 13
    invoke-virtual {v2}, Landroid/graphics/Rect;->height()I

    move-result v5

    int-to-float v5, v5

    mul-float v5, v5, v4

    iget-object v4, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    invoke-virtual {v4}, Landroid/graphics/RectF;->height()F

    move-result v4

    div-float/2addr v5, v4

    .line 14
    iget-object v4, p0, Lcom/esfile/screen/recorder/player/exo/c;->h:Landroid/graphics/Rect;

    iget v6, v2, Landroid/graphics/Rect;->left:I

    int-to-float v6, v6

    iget-object v7, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    iget v8, v7, Landroid/graphics/RectF;->left:F

    mul-float v8, v8, v3

    sub-float/2addr v6, v8

    float-to-int v6, v6

    iput v6, v4, Landroid/graphics/Rect;->left:I

    int-to-float v6, v6

    int-to-float v1, v1

    mul-float v1, v1, v3

    add-float/2addr v6, v1

    float-to-int v1, v6

    .line 15
    iput v1, v4, Landroid/graphics/Rect;->right:I

    .line 16
    iget v1, v2, Landroid/graphics/Rect;->top:I

    int-to-float v1, v1

    iget v2, v7, Landroid/graphics/RectF;->top:F

    mul-float v2, v2, v5

    sub-float/2addr v1, v2

    float-to-int v1, v1

    iput v1, v4, Landroid/graphics/Rect;->top:I

    int-to-float v1, v1

    int-to-float v0, v0

    mul-float v0, v0, v5

    add-float/2addr v1, v0

    float-to-int v0, v1

    .line 17
    iput v0, v4, Landroid/graphics/Rect;->bottom:I

    goto :goto_3

    :cond_5
    const/4 v2, 0x0

    .line 18
    iput-object v2, p0, Lcom/esfile/screen/recorder/player/exo/c;->i:Landroid/graphics/Rect;

    .line 19
    iget v2, p0, Lcom/esfile/screen/recorder/player/exo/c;->c:I

    iget v3, p0, Lcom/esfile/screen/recorder/player/exo/c;->d:I

    iget-object v4, p0, Lcom/esfile/screen/recorder/player/exo/c;->l:Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;

    invoke-static {v2, v3, v1, v0, v4}, Lcom/esfile/screen/recorder/media/util/ScaleTypeUtil;->a(IIIILcom/esfile/screen/recorder/media/util/ScaleTypeUtil$ScaleType;)Landroid/graphics/Rect;

    move-result-object v0

    iput-object v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->h:Landroid/graphics/Rect;

    :cond_6
    :goto_3
    return-void
.end method


# virtual methods
.method public a()V
    .locals 1

    .line 15
    iget-object v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->e:Landroid/graphics/SurfaceTexture;

    if-eqz v0, :cond_0

    .line 16
    invoke-virtual {v0}, Landroid/graphics/SurfaceTexture;->release()V

    .line 17
    :cond_0
    iget-object v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->a:Lcom/esfile/screen/recorder/media/glutils/e;

    if-eqz v0, :cond_1

    .line 18
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/glutils/e;->d()V

    :cond_1
    return-void
.end method

.method public a(I)V
    .locals 3

    if-eqz p1, :cond_1

    const/16 v0, 0x5a

    if-eq p1, v0, :cond_1

    const/16 v0, 0xb4

    if-eq p1, v0, :cond_1

    const/16 v0, 0x10e

    if-ne p1, v0, :cond_0

    goto :goto_0

    .line 4
    :cond_0
    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Unsupported angle: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 5
    :cond_1
    :goto_0
    iget-object v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->a:Lcom/esfile/screen/recorder/media/glutils/e;

    if-eqz v0, :cond_2

    iget v1, p0, Lcom/esfile/screen/recorder/player/exo/c;->j:I

    if-eq p1, v1, :cond_2

    sub-int v1, p1, v1

    .line 6
    invoke-virtual {v0, v1}, Lcom/esfile/screen/recorder/media/glutils/e;->a(I)V

    .line 7
    iput p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->j:I

    .line 8
    invoke-direct {p0}, Lcom/esfile/screen/recorder/player/exo/c;->b()V

    .line 9
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->e:Landroid/graphics/SurfaceTexture;

    invoke-virtual {p0, p1}, Lcom/esfile/screen/recorder/player/exo/c;->onFrameAvailable(Landroid/graphics/SurfaceTexture;)V

    :cond_2
    return-void
.end method

.method public a(II)V
    .locals 0

    .line 1
    iput p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->f:I

    .line 2
    iput p2, p0, Lcom/esfile/screen/recorder/player/exo/c;->g:I

    .line 3
    invoke-direct {p0}, Lcom/esfile/screen/recorder/player/exo/c;->b()V

    return-void
.end method

.method public a(Landroid/graphics/RectF;)V
    .locals 1

    if-nez p1, :cond_0

    .line 10
    iget-object v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    if-eqz v0, :cond_1

    :cond_0
    if-eqz p1, :cond_2

    iget-object v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    .line 11
    invoke-virtual {p1, v0}, Landroid/graphics/RectF;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_2

    :cond_1
    return-void

    .line 12
    :cond_2
    iput-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->k:Landroid/graphics/RectF;

    .line 13
    invoke-direct {p0}, Lcom/esfile/screen/recorder/player/exo/c;->b()V

    .line 14
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->e:Landroid/graphics/SurfaceTexture;

    invoke-virtual {p0, p1}, Lcom/esfile/screen/recorder/player/exo/c;->onFrameAvailable(Landroid/graphics/SurfaceTexture;)V

    return-void
.end method

.method public onDrawFrame(Ljavax/microedition/khronos/opengles/GL10;)V
    .locals 4

    .line 1
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->e:Landroid/graphics/SurfaceTexture;

    if-nez p1, :cond_0

    return-void

    .line 2
    :cond_0
    invoke-virtual {p1}, Landroid/graphics/SurfaceTexture;->updateTexImage()V

    .line 3
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->h:Landroid/graphics/Rect;

    iget v0, p1, Landroid/graphics/Rect;->left:I

    iget v1, p0, Lcom/esfile/screen/recorder/player/exo/c;->d:I

    iget v2, p1, Landroid/graphics/Rect;->top:I

    sub-int/2addr v1, v2

    .line 4
    invoke-virtual {p1}, Landroid/graphics/Rect;->height()I

    move-result p1

    sub-int/2addr v1, p1

    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->h:Landroid/graphics/Rect;

    .line 5
    invoke-virtual {p1}, Landroid/graphics/Rect;->width()I

    move-result p1

    iget-object v2, p0, Lcom/esfile/screen/recorder/player/exo/c;->h:Landroid/graphics/Rect;

    .line 6
    invoke-virtual {v2}, Landroid/graphics/Rect;->height()I

    move-result v2

    .line 7
    invoke-static {v0, v1, p1, v2}, Landroid/opengl/GLES20;->glViewport(IIII)V

    .line 8
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->i:Landroid/graphics/Rect;

    const/16 v0, 0xc11

    if-eqz p1, :cond_1

    .line 9
    invoke-static {v0}, Landroid/opengl/GLES20;->glEnable(I)V

    .line 10
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->i:Landroid/graphics/Rect;

    iget v1, p1, Landroid/graphics/Rect;->left:I

    iget v2, p0, Lcom/esfile/screen/recorder/player/exo/c;->d:I

    iget v3, p1, Landroid/graphics/Rect;->top:I

    sub-int/2addr v2, v3

    .line 11
    invoke-virtual {p1}, Landroid/graphics/Rect;->height()I

    move-result p1

    sub-int/2addr v2, p1

    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->i:Landroid/graphics/Rect;

    .line 12
    invoke-virtual {p1}, Landroid/graphics/Rect;->width()I

    move-result p1

    iget-object v3, p0, Lcom/esfile/screen/recorder/player/exo/c;->i:Landroid/graphics/Rect;

    .line 13
    invoke-virtual {v3}, Landroid/graphics/Rect;->height()I

    move-result v3

    .line 14
    invoke-static {v1, v2, p1, v3}, Landroid/opengl/GLES20;->glScissor(IIII)V

    .line 15
    :cond_1
    :try_start_0
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->a:Lcom/esfile/screen/recorder/media/glutils/e;

    iget-object v1, p0, Lcom/esfile/screen/recorder/player/exo/c;->e:Landroid/graphics/SurfaceTexture;

    invoke-virtual {p1, v1}, Lcom/esfile/screen/recorder/media/glutils/e;->a(Landroid/graphics/SurfaceTexture;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 16
    :catch_0
    invoke-static {v0}, Landroid/opengl/GLES20;->glDisable(I)V

    .line 17
    iget p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->c:I

    iget v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->d:I

    const/4 v1, 0x0

    invoke-static {v1, v1, p1, v0}, Landroid/opengl/GLES20;->glViewport(IIII)V

    return-void
.end method

.method public declared-synchronized onFrameAvailable(Landroid/graphics/SurfaceTexture;)V
    .locals 0

    monitor-enter p0

    .line 1
    :try_start_0
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->b:Lcom/esfile/screen/recorder/player/exo/c$a;

    if-eqz p1, :cond_0

    .line 2
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->b:Lcom/esfile/screen/recorder/player/exo/c$a;

    invoke-interface {p1}, Lcom/esfile/screen/recorder/player/exo/c$a;->a()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 3
    :cond_0
    monitor-exit p0

    return-void

    :catchall_0
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public onSurfaceChanged(Ljavax/microedition/khronos/opengles/GL10;II)V
    .locals 1

    .line 1
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "onSurfaceChanged "

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v0, " "

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    const-string v0, "GLVideoRender"

    invoke-static {v0, p1}, Lcom/esfile/screen/recorder/media/util/k;->c(Ljava/lang/String;Ljava/lang/String;)V

    .line 2
    iput p2, p0, Lcom/esfile/screen/recorder/player/exo/c;->c:I

    .line 3
    iput p3, p0, Lcom/esfile/screen/recorder/player/exo/c;->d:I

    .line 4
    invoke-direct {p0}, Lcom/esfile/screen/recorder/player/exo/c;->b()V

    const/4 p1, 0x0

    .line 5
    invoke-static {p1, p1, p2, p3}, Landroid/opengl/GLES20;->glViewport(IIII)V

    return-void
.end method

.method public onSurfaceCreated(Ljavax/microedition/khronos/opengles/GL10;Ljavax/microedition/khronos/egl/EGLConfig;)V
    .locals 1

    const-string p1, "GLVideoRender"

    const-string p2, "onSurfaceCreated"

    .line 1
    invoke-static {p1, p2}, Lcom/esfile/screen/recorder/media/util/k;->c(Ljava/lang/String;Ljava/lang/String;)V

    .line 2
    new-instance p1, Lcom/esfile/screen/recorder/media/glutils/e;

    invoke-direct {p1}, Lcom/esfile/screen/recorder/media/glutils/e;-><init>()V

    iput-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->a:Lcom/esfile/screen/recorder/media/glutils/e;

    .line 3
    invoke-virtual {p1}, Lcom/esfile/screen/recorder/media/glutils/e;->c()V

    .line 4
    new-instance p1, Landroid/graphics/SurfaceTexture;

    iget-object p2, p0, Lcom/esfile/screen/recorder/player/exo/c;->a:Lcom/esfile/screen/recorder/media/glutils/e;

    invoke-virtual {p2}, Lcom/esfile/screen/recorder/media/glutils/e;->b()I

    move-result p2

    invoke-direct {p1, p2}, Landroid/graphics/SurfaceTexture;-><init>(I)V

    iput-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->e:Landroid/graphics/SurfaceTexture;

    .line 5
    invoke-virtual {p1, p0}, Landroid/graphics/SurfaceTexture;->setOnFrameAvailableListener(Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;)V

    .line 6
    iget-object p1, p0, Lcom/esfile/screen/recorder/player/exo/c;->b:Lcom/esfile/screen/recorder/player/exo/c$a;

    if-eqz p1, :cond_0

    .line 7
    new-instance p2, Landroid/view/Surface;

    iget-object v0, p0, Lcom/esfile/screen/recorder/player/exo/c;->e:Landroid/graphics/SurfaceTexture;

    invoke-direct {p2, v0}, Landroid/view/Surface;-><init>(Landroid/graphics/SurfaceTexture;)V

    invoke-interface {p1, p2}, Lcom/esfile/screen/recorder/player/exo/c$a;->a(Landroid/view/Surface;)V

    :cond_0
    return-void
.end method
